package com.ld.campus_help.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ld.campus_help.entity.Lost;
import com.ld.campus_help.entity.Serve;
import com.ld.campus_help.entity.Unused;
import com.ld.campus_help.mapper.UnusedMapper;
import com.ld.campus_help.service.ServeService;
import com.ld.campus_help.mapper.ServeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
* @author 10937
* @description 针对表【serve】的数据库操作Service实现
* @createDate 2023-08-24 20:34:16
*/
@Service
public class ServeServiceImpl extends ServiceImpl<ServeMapper, Serve>
    implements ServeService{
    @Autowired
    private ServeMapper serveMapper;

    @Override
    public void saveUnused(Unused deleted) {
        Serve serve = new Serve();
        serve.setServiceTime(new Date());
        serve.setStatus(1);
        serve.setType("失物招领");
        serve.setUserId(deleted.getUserId());
        serve.setDestId(deleted.getId());
        serveMapper.insert(serve);
    }

    @Override
    public void saveLost(Lost deleted) {
        Serve serve = new Serve();
        serve.setServiceTime(new Date());
        serve.setStatus(1);
        serve.setType("闲置");
        serve.setUserId(deleted.getUserId());
        serve.setDestId(deleted.getId());
        serveMapper.insert(serve);
    }
}




